CMAKE_MINIMUM_REQUIRED(VERSION 2.8)


include_directories(${LITEPLAYER_INCLUDES})
include_directories(${COMN_DIR}/include)
include_directories(${GLOOX_DIR}/src)
include_directories(${PROJECT_ROOT}/RtpCaster)
include_directories(${PROJECT_ROOT}/RtspCaster)
include_directories(${PROJECT_ROOT}/RtspRelay)

link_directories(${LITEPLAYER}/lib)
link_directories(${COMN_DIR}/lib)
link_directories(${GLOOX_DIR}/lib)

if (MSVC)
	SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO")
else()
endif()

aux_source_directory(. SOURCES)

add_executable(LiveRelayServer ${SOURCES})

target_link_libraries(LiveRelayServer
	${LIB_PLATFORM}
	debug comnd optimized comn
	RtpCaster
	RtspCaster
	RtspRelay
	${GLOOX_LIBS}
	)


if(WIN32)	
set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION .)	
endif()
	
include(InstallRequiredSystemLibraries)

set(CPACK_PACKAGE_NAME "LiveRelayServer")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "live relay server")
set(CPACK_PACKAGE_VENDOR "100wits.com")
set(CPACK_PACKAGE_VERSION_MAJOR "1")
set(CPACK_PACKAGE_VERSION_MINOR "0")
set(CPACK_PACKAGE_VERSION_PATCH "0")
	
if(UNIX)
	SET(CPACK_GENERATOR "DEB")
	set(CPACK_DEBIAN_PACKAGE_MAINTAINER "chuanjiang.zh@qq.com")
else()
	SET(CPACK_GENERATOR "ZIP")
endif()

if(WIN32)
	install(FILES ${PROJECT_ROOT}/bin/LiveRelayServer.exe DESTINATION .)
	install(FILES ${PROJECT_ROOT}/LiveRelayServer/LiveRelay.ini DESTINATION .)
else()
	install(TARGETS LiveRelayServer DESTINATION bin)
	install(FILES ${PROJECT_ROOT}/LiveRelayServer/LiveRelay.ini DESTINATION etc)
	
	#set( CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${PROJECT_ROOT}/setup/postinst;${PROJECT_ROOT}/setup/prerm;" )
endif()

include(CPack)	
